//
//  ZJMainTabbarViewController.m
//  Weibo29
//
//  Created by 曾静 on 16/6/28.
//  Copyright © 2016年 qq. All rights reserved.
//

#import "ZJMainTabbarViewController.h"
#import "ZJHomeTableViewController.h"
#import "ZJMessageTableViewController.h"
#import "ZJDiscoverTableViewController.h"
#import "ZJProfileTableViewController.h"
#import "ZJTabbar.h"
#import "ZJBaseNavViewController.h"
@interface ZJMainTabbarViewController ()

@end

@implementation ZJMainTabbarViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    [self addViewControllers:[ZJHomeTableViewController new] andTitle:@"首页" andImageName:@"tabbar_home"];
    
    [self addViewControllers:[ZJMessageTableViewController new] andTitle:@"消息" andImageName:@"tabbar_message_center"];
    
    [self addViewControllers:[ZJDiscoverTableViewController new] andTitle:@"发现" andImageName:@"tabbar_discover"];
    
    [self addViewControllers:[ZJProfileTableViewController new] andTitle:@"我" andImageName:@"tabbar_profile"];
    
    [self setTabBar];
    
    [self setTitColor];

}

- (void)setTabBar {
    
    ZJTabbar *tabbar = [[ZJTabbar alloc]init];
    
    [self setValue:tabbar forKey:@"tabBar"];
    
    tabbar.callBack = ^{
        
        //弹出控制器
    };
    
    
}
-(void)setTitColor{
    
    
    [self.tabBar  setTintColor:[UIColor orangeColor]];
    
      
    
}
//添加自控制器
-(void)addViewControllers:(UIViewController*)vc andTitle:(NSString *)title andImageName:(NSString *)imageName {
    
    
    vc.title = title;
    
    
    vc.tabBarItem.image = [UIImage imageNamed:imageName];
    
    
    vc.tabBarItem.selectedImage = [UIImage imageNamed:[NSString stringWithFormat:@"%@_selected",imageName]];
    
    
    ZJBaseNavViewController *nav = [[ZJBaseNavViewController alloc]initWithRootViewController:vc];
    
    
    [self addChildViewController:nav];
    
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
